package com.fanxuankai.boot.plumelog.autoconfigure;

import com.plumelog.core.TraceIdFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

import javax.servlet.Filter;

/**
 * @author fanxuankai
 */
@ConditionalOnClass({Filter.class})
@ConditionalOnProperty(name = PlumeLogProperties.ENABLED, matchIfMissing = true)
public class TraceIdFilterAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public TraceIdFilter traceIdFilter() {
        return new TraceIdFilter();
    }
}